var DiskModalDemo = angular.module('FusionStorUI.disk', []);
DiskModalDemo.controller('DiskModalCtrl', ['$scope','$modal', function($scope, $modal) {
    var modalInstance ;
    $scope.open = function(url, html) {  
        $scope.item = {};
        modalInstance = $modal.open({  
            templateUrl : url,
            backdrop: 'static',  
            keyboard: false,
            controller : DiskModalInstanceCtrl,  
            resolve : { 
                item : function() {  
                    return $scope.item;  
                }  
            }  
        });  
    };  
    $scope.close = function() {
        modalInstance.dismiss('cancel');  
    }
}]); 
var DiskModalInstanceCtrl = function($scope, $modalInstance, item) {  
    $scope.item = item;  
    $scope.selected = {  
        item : $scope.item 
    };  
    $scope.disk_delete = function(host_id, disk_id) {  
        eval('delete_disk("'+host_id+'", false)'); 
    };

    $scope.disk_add = function(disk_id, force) {  
        eval('add_disk("'+disk_id+'",'+force +')'); 
    };

    $scope.raid_missing = function() {  
        raid_missing();
    };
    
    $scope.raid_delete = function(disk_id, force) {  
        eval('raid_delete("'+disk_id+'", ' + force +', 0)'); 
    };

    $scope.raid_add = function(disk_id, force) {  
        eval('raid_add("'+disk_id+'", ' + force +', 0)'); 
    };

    $scope.cancel = function() {  
        $modalInstance.dismiss('cancel');  
    };  

};  
  
